#include "fTask.h"

fTask::fTask()
{
}

void fTask::setupUi(QWidget *parent)
{
	QLabel *lbName = new QLabel(tr("Task name : "), parent);
	eName = new QLineEdit(parent);
	eName->setObjectName("eName");
	
	QGroupBox *gbDescription = new QGroupBox(tr("Description"), parent);
	eDesc = new QTextEdit(parent);
	eDesc->setObjectName("eDesc");
	
	QLabel *lbProviders = new QLabel(tr("Providers : "), parent);
	cbProviders = new QComboBox(parent);
	cbProviders->setObjectName("cbProviders");
	
	QLabel *lbAddDate = new QLabel(tr("Added date : "), parent);
	dtAddDate = new QDateEdit(parent);
	dtAddDate->setObjectName("dtAddDate");
	dtAddDate->setEnabled(false);
	
	QLabel *lbDueDate = new QLabel(tr("Due date : "), parent);
	dtDueDate = new QDateEdit(parent);
	dtDueDate->setObjectName("dtDueDate");
	dtDueDate->setCalendarPopup(true);

	btValid = new QPushButton(parent);
	btValid->setObjectName("btValid");
	btValid->setText(tr("Valid"));
	
	btCancel = new QPushButton(parent);
	btCancel->setObjectName("btCancel");
	btCancel->setText(tr("Cancel"));
	
	/*
		Layout
	*/
	
	// HB Provider edit and box
	QHBoxLayout *hbProvider = new QHBoxLayout;
	hbProvider->addWidget(lbProviders);
	hbProvider->addWidget(cbProviders);
	
	// HB Name edit and label
	QHBoxLayout *hbName = new QHBoxLayout;
	hbName->addWidget(lbName);
	hbName->addWidget(eName);
	
	// HB Due and added dates
	QHBoxLayout *hbDates = new QHBoxLayout;
	hbDates->addWidget(lbAddDate);
	hbDates->addWidget(dtAddDate);
	hbDates->addStretch();
	hbDates->addWidget(lbDueDate);
	hbDates->addWidget(dtDueDate);
	
	// GB Description
	QHBoxLayout *hbDescription = new QHBoxLayout;
	hbDescription->addWidget(eDesc);
	gbDescription->setLayout(hbDescription);
	
	// HB Buttons
	QHBoxLayout *hbButtons = new QHBoxLayout;
	hbButtons->addStretch();
	hbButtons->addWidget(btValid);
	hbButtons->addWidget(btCancel);
	
	// VB All
	QVBoxLayout *vbAll = new QVBoxLayout;
	vbAll->addLayout(hbProvider);
	vbAll->addLayout(hbName);
	vbAll->addLayout(hbDates);
	vbAll->addWidget(gbDescription);
	vbAll->addLayout(hbButtons);
	
	parent->setLayout(vbAll);
}
